// src/api/home.js
import request from '@/utils/request'

// 供方列表
export function getProductList(params) {
  return request({
    url: 'api/public/product/v1/page',
    method: 'get',
    params
  })
}

export function productTypeList(params) {
  return request({
    url: 'api/public/dict/v1/productTypeParent',
    method: 'get',
    params
  })
}
export function productTypeChildrenList(params) {
  return request({
    url: 'api/public/dict/v1/productTypeChildren',
    method: 'get',
    params
  })
}

// 供方详情
export function getProductDetail(params) {
  return request({
    url: 'api/public/product/v1/detail',
    method: 'get',
    params
  })
}

// 需方列表
export function getRequirementList(params) {
  return request({
    url: 'api/public/requirement/v1/page',
    method: 'get',
    params
  })
}
// 需方详情
export function getRequirementetail(params) {
  return request({
    url: 'api/public/requirement/v1/detail',
    method: 'get',
    params
  })
}
// 发布产品
export function publishProduct(data) {
  return request({
    url: 'api/products',
    method: 'post',
    data
  })
}

// 我的产品列表
export function getProductOwePage(params) {
  return request({
    url: 'api/private/product/v1/owePage',
    method: 'get',
    params
  })
}

// 服务产品上架
export function productGround(data) {
  return request({
    url: 'api/private/product/v1/ground',
    method: 'post',
    data
  })
}


export function productRevoke(data) {
  return request({
    url: 'api/private/product/v1/revoke',
    method: 'post',
    data
  })
}

export function productDelete(data) {
  return request({
    url: 'api/private/product/v1/delete',
    method: 'post',
    data
  })
}

export function saveProduct(data) {
  return request({
    url: 'api/private/product/v1/save',
    method: 'post',
    data
  })
}

export function requirementEdit(data) {
  return request({
    url: 'api/private/requirement/v1/edit',
    method: 'post',
    data
  })
}

export function requirementPublish(data) {
  return request({
    url: 'api/private/requirement/v1/publish',
    method: 'post',
    data
  })
}

export function requirementClose(data) {
  return request({
    url: 'api//private/requirement/v1/close',
    method: 'post',
    data
  })
}

// 我的需求列表
export function requirementPagePrivate(params) {
  return request({
    url: 'api/private/requirement/v1/page',
    method: 'get',
    params
  })
}

// 桂企
export function getCompanyPage(params) {
  return request({
    url: 'api/public/company/v1/page',
    method: 'get',
    params
  })
}

export const getFileUrl = `${process.env.VUE_APP_BASE_API}api/public/file/v1/public/get/`

export function uploadFile(data) {
  return request({
    url: 'api/public/file/v1',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

